<?php echo $header; ?>
<style>
    #tool_1 {
        display:none;
        position:absolute;
        z-index:1000;
        -moz-border-radius:4px;
        -webkit-border-radius:4px;
    }

    .tooltip-style1_1 {
        background:#5a85a5 10px center no-repeat;
        color:white;
        min-height:30px;
        padding:10px 20px 10px 10px;
        opacity:0.95;
        width:100px;
    }
    .tooltip-style2 {
        background:#363636;
        padding:3px;
        color:white;
        text-align:center;
    }
    pre {
        font-size:10px;
    }
</style>    
<script type="text/javascript">
    // Shipping hover
 	jQuery(document).ready(function() {		
		jQuery(".tooltips_shipping").hover(
			function(){ jQuery('#tooltips_shipping').css({ display: "block" }); },
			function() { jQuery('#tooltips_shipping').css({ display: "none" }); }
		);
	});
</script>

<!-- Content -->
<div id="main" class="p13t">
    <!-- Left column -->
    <?php echo $column_left; ?>
    
    <div id="col2" class="w709">
        <div class="box_tt">               
            <?php if(1==0){ ?>                    
            <h4 class="float_left p5t">Produkter</h4>
            <?php } ?>        
            <h4 class="float_left p5t">           
                <?php foreach ($breadcrumbs as $breadcrumb) { ?> 
                    <?php if($breadcrumb['href']) { ?>
                        <span class="breadcrumb_sep"><?php echo $breadcrumb['separator']; ?></span>
                        <a href="<?php echo $breadcrumb['href']; ?>" ><span class="breadcrumb_text"><?php echo $breadcrumb['text']; ?></span></a>
                    <?php }else{ ?>
                        <span class="breadcrumb_sep"><?php echo $breadcrumb['separator']; ?></span><span class="breadcrumb_text"><?php echo $breadcrumb['text']; ?></span>                    
                    <?php } ?>
                <?php } ?>
            </h4>
            <!-- span class="float_right"><a href="<?php echo $back; ?>"><img src="catalog/view/theme/<?php echo $template; ?>/images/bt_tibage.png"/></a></span --> 
        </div>
		
        <div class="box_content_underpage">
            <div class="box_content_underpage1 min_heght">
                <div class="p15t p15l p20r min_heght2">
                    <div id="product_content" class="p2t p15b">
                        <!-- normal view of product images -->
                        <div class="wr-product-main clearfix">
                            <div class="wr-show-images">
                                <div class="img-larg">
                                    <a id="cloud_zoom" class='cloud-zoom' href="<?php echo $full; ?>" title="<?php echo $heading_title; ?>" rel="adjustX: 1, adjustY: 0, position: 'right', zoomWidth: 430, zoomHeight: 535, titleOpacity: 1">
                                        <img id="image" src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" width="285" height="346"/>
                                    </a>
                                </div><!--.img-larg-->

                                <?php if ($images) { ?>
                                    <?php $i = 0; $count = count($images); ?>
                                    <ul>
                                        <?php foreach ($images as $image) { ?>
                                            <?php $i++; ?>
                                            <li <?php echo ($i == $count || $i % 4 == 0 ? 'class="no-mar"' : ''); ?>>
                                                <a class="cloud-zoom-gallery" href="<?php echo $image['full']; ?>" title="<?php echo $heading_title; ?>" rel="useZoom: 'cloud_zoom', smallImage: '<?php echo $image['popup'];?>'">
                                                    <img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>"/>
                                                </a>
                                            </li>
                                        <?php } ?>
                                    </ul>
                                <?php } ?>

                                <div class="box_zom2 clearfix">
                                    <a id="zoom_view" href="<?php echo $zoom_view; ?>"><img src="catalog/view/theme/<?php echo $template; ?>/images/bt_zoom.png"/></a>
                                    <a id="size_view" href="#"><img src="catalog/view/theme/<?php echo $template; ?>/images/bt_normal_o.png"/></a>
                                </div><!--.box_zom2-->
                            </div><!--.show-images-->
                          
                            <div class="wr-info-products">
                          	    <div class="info-products-title">
                                    <div class="info-products-title-top"></div><!--.info-products-title-top-->
                                    <div class="info-products-title-mid">
                                        <p>
                                            Vare-nummer: <span id="product_number"><?php echo $sku; ?></span><br />
                                            <?php echo $short_title; ?><br />
                                            <?php if(!empty($discounts) || $discount){ ?>
                                                Nu: <span id="product_price" style="color:#f85800; font-weight: bold; margin-right: 3px;"><?php echo $discount; ?></span>
                                                Før: <span style="color:#000000; font-weight: bold; margin-right: 3px; text-decoration: line-through;"><?php echo $price; ?></span>
                                                <span class="view-price tooltips_shipping" style="font-weight:normal;font-size:12px;cursor:pointer;">Se pris inkl. fragt/gebyr</span>
                                            <?php }else{ ?>
                                                Pris: <span id="product_price" style="color:#f85800; font-weight: bold; margin-right: 20px;"><?php echo $price; ?></span>
                                                <span class="view-price tooltips_shipping" style="font-weight:normal;cursor:pointer;">Se pris inkl. fragt/gebyr</span>
                                            <?php } ?>
                                            <div id='tooltips_shipping' class="tooltips_shipping_style"><?php echo $shipping_note; ?></div>
                                        </p>
                                    </div><!--.info-products-title-mid-->
                                    <div class="info-products-title-bottom"></div><!--.info-products-title-bottom-->
                                    <div class="cb"></div>
                                </div><!--.info-products-title-->

                                <div class="info-products-content">
                                    <div class="content_area">
                                        <div id="content_desc"><?php echo $description; ?></div>
                                        <div class="bnt-readmore"><a class="read-more" href="#">Læs mere</a></div><!--.bnt-readmore-->
                                    </div>

                                    <div class="add-cart">										
										<form action="<?php echo str_replace('&', '&amp;', $action); ?>" method="post" enctype="multipart/form-data" id="product">                                            
											<div style="margin:10px 0 10px 0; font-size:12px; font-weight:bold;">
												<img style="vertical-align:middle; margin:0; padding:0 5px 0 0; display:inline;" src="catalog/view/theme/<?php echo $template; ?>/images/icon_car.jpg" alt=""/> 
												<?php if($delay_delivery){ ?>
													<span style="">Leveringstid: 3 &ndash; 6 hverdage</span>
												<?php }else{ ?>
													<span style="">Leveringstid: 1 &ndash; 3 hverdage</span>
												<?php } ?>
											</div><!-- &#10004; &#10003; &#x2713;  -->											
											<?php foreach ($options as $option) { ?>
                                                <div>
                                                    <span><?php echo $option['name'] ?></span><br/>
                                                    <select id="product_option_<?php echo $option['option_id']; ?>" class="product_option_list lbox" name="option[<?php echo $option['option_id']; ?>]">
                                                        <option value="none" rel="0" alt="<?php echo $sku; ?>">Vælg <?php echo $option['name'] ?></option>
                                                        <?php foreach ($option['option_value'] as $option_value) { ?>
                                                            <option value="<?php echo $option_value['option_value_id']; ?>" rel="<?php echo $option_value['price']; ?>" alt="<?php echo $option_value['option_number']; ?>" shape="<?php echo $option_value['quantity']; ?>"><?php echo $option_value['name']; ?></option>
                                                        <?php } ?>
                                                    </select>
                                                </div>
                                            <?php } ?>
                                            <div>
                                                <span>Antal</span><br/>
                                                <input type="text" id="product_qty" class="number" name="quantity" value="1" size="2" maxlength="2"/>
                                                <input type="button" id="add_to_cart" class="bnt-addcard"/>
                                            </div>
                                            <input type="hidden" name="product_id" value="<?php echo $product_id; ?>"/>
                                            <input type="hidden" name="redirect" value="<?php echo str_replace('&', '&amp;', $redirect); ?>"/>
                                            <input type="hidden" name="product_category" value="<?php echo $product_category; ?>"/>
                                        </form>
                                    </div>
                                    <!--.add-cart-->
                                    <div>
                                        <a id="send_question_button" title="Send et spørgsmål til dette produkt" href="#"><img src="catalog/view/theme/<?php echo $template; ?>/images/question_for_product.png" alt=""/></a>
                                    </div>
                                </div><!--.info-products-content-->

                                <div class="mail-face">
                                    <div class="mail">
                                        <a class="pr_button_email pr_bt_b osx" id="send_friend_email" title="E-mail" href="#"><span class="pr_bt_bs pr_button_email"></span></a>
                                    </div><!--.mail-->
                                    <div class="face">
                                        <iframe src="//www.facebook.com/plugins/like.php?locale=da_DK&amp;href=<?php echo $current_url; ?>&amp;send=false&amp;layout=button_count&amp;width=150&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=tahoma&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:150px; height:21px;" allowTransparency="true"></iframe>
                                    </div><!--.mail-->
                                </div><!--.mail-face-->
                            </div><!--.wr-info-products-->
                            <div class="cb"></div>

                            <div class="wr-re_products">
                                <?php if(!empty($products)){ ?>
                                    <h2>Relaterede produkter</h2>
                                    <ul>
                                        <?php $count = count($products); $i = 1; ?>
                                        <?php foreach($products as $related_item){ ?>
                                            <li <?php echo (($i == $count || $i % 4 == 0) ? 'class="no-mar"' : '') ?>>
                                                <div class="img"><a href="<?php echo $related_item['href']; ?>"><img src="<?php echo $related_item['image']; ?>" alt="<?php echo $related_item['name']; ?>"/></a></div><!--.img-->
                                                <div class="pro-name"><p><?php echo $related_item['name']; ?></p></div><!--.pro-name-->
                                                <div class="pro-prices"><?php echo $related_item['price']; ?></div><!--.pro-prices-->
                                                <div class="bnt-bestil"><a href="<?php echo $related_item['href']; ?>"><img src="catalog/view/theme/<?php echo $template; ?>/images/bnt-bestil.jpg" /></a></div><!--.bnt-bestil-->
                                            </li>
                                            <?php $i++; ?>
                                        <?php } ?>
                                    </ul>
                                <?php } ?>
                            </div><!--.wr-re_products-->

                            <div class="size-guide">
                                <?php if(($size_guide != '') && ($size_guide != 'none')){ ?>
                                    <h2><a id="size_guide_btn" href="#">Størrelsesguide</a></h2>
                                    <?php
                                        $except_list = array(
                                            'hempel_farvekort'  => 'Hempel Farvekort',
                                            'ox_on' => 'OX-ON Størrelsesskema',
                                        );
                                    ?>
                                    <div id="size_guide_data" style="display:none;">
                                        <?php if(array_key_exists($size_guide, $except_list)){ ?>
                                            <a target="_blank" style="font-size: 14px; color: #0C4F7D;" href="<?php echo $download_link . $size_guide . '.pdf'; ?>">Hent:&nbsp;<?php echo $except_list[$size_guide]; ?>&nbsp;PDF fil</a>
                                        <?php }else{ ?>
                                            <?php echo $size_guide_data; ?>
                                        <?php } ?>
                                    </div>
                                <?php } ?>
                             </div><!--.size-giude-->
                        </div><!--.wr-product-main-->
                    </div>                         
                </div> 
                <div id="bottom_nav" class="bt_tab">
                    <p class="p15l float_left p12t"><a href="<?php echo $back; ?>"><img src="catalog/view/theme/<?php echo $template; ?>/images/bt_tibage.png"/></a></p>
                    <p class="p15r float_right p12t"><a href="<?php echo $checkout; ?>"><img src="catalog/view/theme/<?php echo $template; ?>/images/bt_indkobskurven2.png"/></a></p>
                    <p class="cb"></p>
                </div>
                </div>                
            </div>
        
            <div class="box_bottom">
                <div class="all_page_bt"></div>
            </div>
        </div>
        <p class="cb"></p>
    </div>
				
	<!-- popup -->     
    <div id="cart_popup_msg">             
        <div id="cart_popup_content">
            <div class="box_all_pop1">
                <p class="p5t p36b"><img src="catalog/view/theme/<?php echo $template; ?>/images/text_vare.png"/></p>
                <p class="p10t">            	 
				    <a href="<?php echo $checkout; ?>"><img src="catalog/view/theme/<?php echo $template; ?>/images/bt_indkobskurven1.png" style="padding-right:5px" /></a>
				    <a id="close_popup_msg" href="<?php echo '#';//$next_step; ?>"><img src="catalog/view/theme/<?php echo $template; ?>/images/bt_taet.png" /></a>
			    </p>
            </div>
        </div>
    </div>
	 	
    <!-- Tell friend -->
	<?php echo $tellfriend; ?> 
    
    <!-- Send a question -->
    <?php echo $send_question; ?> 
</div>
<!-- End content -->

<!-- Footer -->
<?php echo $footer; ?> 

<link type="text/css" rel="stylesheet" href="catalog/view/theme/<?php echo $template; ?>/css/cloud-zoom.css" />
<script type="text/javascript" src="catalog/view/theme/<?php echo $template; ?>/js/cloud-zoom.1.0.2.js"></script>
<script type="text/javascript" src="catalog/view/theme/<?php echo $template; ?>/js/flowplayer-3.2.8.min.js"></script>

<!-- Add to cart -->
<script type="text/javascript">
//<![CDATA[
	jQuery('a#close_popup_msg').live('click', function(event){    
        event.preventDefault();
        
		jQuery.modal.close();
	});
	
    var numeric_filter = /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)|(^-?\d*$)/;   
    var in_stock = <?php echo $stock; ?>; 
    jQuery('#add_to_cart').live('click', function(event){    
        event.preventDefault();                
        
        if(in_stock <= 0){
            confirm('Fejl', 'Dette produkt er ikke nok mængde på lager.', 'notify');
            //jQuery('#add_product_error').html('<span id="option_error" style="">Dette produkt er ikke længere på lager.</span>');
            
            return false; 
        } 
        
        var size_qty = jQuery("select[id*='product_option_'] option:selected").attr('shape') * 1;
        var qty = jQuery('#product_qty').val();
        if(in_stock < qty || size_qty < qty){
            confirm('Bemærk', 'Dette antal er ikke på lager. Ring 48301699 eller send os en MAIL på <a style="color:#4CD7FF;" href="mailto:webshop@havhokeren.dk">webshop@havhokeren.dk</a>.', 'notify');
            jQuery('#product_qty').val(1);

            return false; 
        }

        var valid_attribute = jQuery('select.product_option_list').length > 0; 
        var option_name = '';
        jQuery('select.product_option_list').each(function(){  
            if(jQuery(this).val() == 'none'){
                valid_attribute = false;
                if(option_name == ''){
                    option_name = jQuery(this).siblings('span').eq(0).html();
                    option_name = option_name.replace(':', '');
                    option_name = option_name.replace(' ', '');
                }
            }             
        });
       
        if(!valid_attribute && (option_name != '')) {  
            //jQuery('#add_product_error').html('<span id="option_error" style="">Vælg venligst en "' + option_name + '"</span>');
            //jQuery('#add_product_error').show();
            confirm('Fejl', 'Vælg venligst en "' + option_name + '"!', 'notify');
            
            return false;
        }
        
        var quantity = jQuery('#product_qty').val() * 1;        
        if (quantity <= 0 || !numeric_filter.test(jQuery('#product_qty').val())){  
            //jQuery('#add_product_error').html('<span id="option_error" style="">Angiv mængde (kun acceptere antal)</span>');
            //jQuery('#add_product_error').show();
            confirm('Fejl', 'Angiv mængde (kun acceptere antal)', 'notify'); 
		
            return false;
        }
        else {
			jQuery('#add_product_error').html('');
			jQuery('#add_product_error').hide();
		}
		
        jQuery.ajax({
            type: 'post',
            url: 'index.php?route=module/cart/refreshCart',
            dataType: 'html',
            data: jQuery('#product :input'),
            success: function (html) {
                jQuery('p#cart_info').html(html);
            },    
            complete: function () {                
                jQuery('#cart_popup_msg').modal({
                    closeHTML:"",
                    opacity:70,
                    //position: ["10%","30%"],
                    containerCss:{
                        background:"none",
                        border:"none",
                        height:"auto",
                        width:"auto",
                        padding:0

                    },
                    overlayCss:{
                        height:700
                    }
                });
                if (jQuery.browser.msie) {
                    jQuery('#cart_popup_msg').html(jQuery('#cart_popup_msg').html());
                }                
            }
        });    
        
        return false;                     
    });
    
    var ref_price = <?php echo $price_ref; ?>;
    jQuery("select[id*='product_option_']").change(function(){
        //var option_price = parseFloat(ref_price);
        var option_price = ref_price;
        var product_number = '';
        
        jQuery("select[id*='product_option_'] option:selected").each(function(){
            //option_price = option_price * 1 + parseFloat(jQuery(this).attr('rel') * 1);    
            option_price = option_price * 1 + jQuery(this).attr('rel') * 1;    
            product_number = jQuery(this).attr('alt');
        })   
            
        option_price = option_price.toFixed(2);
        option_price = option_price.replace('.', ',');
        option_price = option_price.replace(',00', ',-');        
        
        jQuery('#product_price').html(' DKK ' + option_price);
        jQuery('#product_number').html(jQuery('option:selected', this).attr('alt'));
    });
//]]>
</script>        
 
<!-- Product effect -->       
<script type="text/javascript"><!--  
    jQuery(document).ready(function(){
        jQuery('#cloud_zoom').click(function(even){
			even.preventDefault();
        });
        
        <?php if($video){ ?>
            jQuery('a.video_thumb_view').click(function(even){
                even.preventDefault();
                
                //jQuery('#video_player').html('<embed id="video_player_obj" name="video_player_obj" src="' + jQuery('#video_player').attr('rel') + '" flashvars="videoURL=' + jQuery('#video_player').attr('alt') + '" type="application/x-shockwave-flash" width="300" height="315" align="middle" allowfullscreen="true" scale="showall" allowscriptaccess="sameDomain" wmode="transparent" quality="high" bgcolor="#FFFFFF" />');
                
                flowplayer(
                    "video_player",
                    "catalog/view/theme/<?php echo $template; ?>/swf/flowplayer-3.2.9.swf",
                    {
                        clip: {
                            url: jQuery('#video_player').attr('rel'),
                            autoPlay: true,
                            autoBuffering: true
                        },
                        play: {
                            replay: true,
                            label: null,
                            replayLabel: "Klik for at spille igen"
                        }
                    }
                );                
                
                jQuery('#product_image_view').hide();
                jQuery('#product_video_view').show();
            });
           
            jQuery('a.cloud-zoom-gallery').click(function(even){
                even.preventDefault();
                
                jQuery('#video_player').html('');
                jQuery('#product_image_view').show();
                jQuery('#product_video_view').hide();
            }); 
        <?php } ?>
        
		<?php if($youtube_video){ ?>
            jQuery('a.video_thumb_view').click(function(even){
                even.preventDefault();
                
				jQuery('#youtube_video_view').html('<iframe class="youtube-player" frameborder="0" src="http://www.youtube.com/embed/<?php echo $youtube_video; ?>?rel=0" title="Youtube video player" type="text/html" width="<?php echo $youtube_video_width; ?>" height="<?php echo $youtube_video_height; ?>" ></iframe>');
                jQuery('#product_image_view').hide();
                jQuery('#youtube_video_view').show();
           }); 
           
            jQuery('a.cloud-zoom-gallery').click(function(even){
                even.preventDefault();
                                
                jQuery('#product_image_view').show();
				jQuery('#youtube_video_view').html('');
                jQuery('#product_video_view').hide();
            }); 
        <?php } ?>

        var adjustHeight = 140;
        var moreText = 'Læs mere';
        var lessText = 'Mindre';
        if(jQuery("#content_desc").height() > adjustHeight){
            jQuery("#content_desc").css('height', adjustHeight).css('overflow', 'hidden');
            jQuery("a.read-more").text(moreText);
            jQuery("a.read-more").toggle(
                function () {
                    jQuery("#content_desc").css('height', 'auto').css('overflow', 'visible');
                    jQuery(this).text(lessText);
                    jQuery("#content_desc").trigger('focus');
                },
                function () {
                    jQuery("#content_desc").css('height', adjustHeight).css('overflow', 'hidden');
                    $(this).text(moreText);
                    jQuery("#content_desc").trigger('focus');
                }
            );
        }
        else{
            jQuery('div.bnt-readmore').hide();
        }

        jQuery("a.read-more").click(function(event){
            event.preventDefault();
        });
        /*
        var showChar = 150;
        var content = jQuery('#content_desc').html();
        if (content.length > showChar) {
            var c = content.substr(0, showChar);
            var h = content.substr(showChar - 1, content.length - showChar);
            var html = c + '<span class="bnt-readmore"><a class="content_desc_more" href="#">Read more</a></span>';

            jQuery('#content_desc').html(html);
        }

        jQuery(".content_desc_more").click(function () {
            if (jQuery(this).hasClass("less")) {
                $(this).removeClass("less");
            }
            else {
                $(this).addClass("less");
            }

            $(this).parent().prev().toggle();
            $(this).prev().toggle();

            return false;
        });
        */
    });

    // Zoom and normal view
    jQuery('#size_view').bind('click', function(event){
        event.preventDefault();            
    });

    jQuery('#size_guide_btn').bind('click', function (event) {
        event.preventDefault();

        jQuery('#size_guide_data').toggle();
    });
    
	jQuery('#product_qty').focus(function(e) {
		if (jQuery(this).val() == 1) {
			jQuery(this).val('');
		}
	});
	jQuery('#product_qty').blur(function(e) {
		if (jQuery(this).val() == '') {
			jQuery(this).val('1');
		}
	}); 
    
    jQuery('#send_question_button').bind('click', function(e) {
        e.preventDefault();
        
        sendQuestionForm(window.location.href);
    });
//-->
</script>
